package org.gnyxy.controller.front;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.gnyxy.constant.StatusConstant;
import org.gnyxy.dto.CarouselPageQueryDTO;
import org.gnyxy.entity.Carousel;
import org.gnyxy.result.PageResult;
import org.gnyxy.result.Result;
import org.gnyxy.service.CarouselService;
import org.gnyxy.vo.CarouselVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("UserCarouselController")
@RequestMapping("/front/carousel")
@Slf4j
@Api(tags = "小程序端-轮播图")
public class CarouselController {
    @Autowired
    private CarouselService carouselService;

    /**
     * 轮播图展示
     * @return
     */
    @GetMapping("/getAll")
    @ApiOperation("展示轮播图")
    @Cacheable(cacheNames = "CarouselCache",key = "'AllCarousels'")
    public Result<List<CarouselVO>> getAll(){
        log.info("展示轮播图");
        List<CarouselVO> carouselVOS = carouselService.getAll();
        return Result.success(carouselVOS);
    }

}
